<?xml version='1.0' encoding='UTF-8' ?>
        <xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'
        xmlns:my='http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-12-14T10:15:01'>
        <xsl:output method='xml' standalone='yes' />
        <xsl:template match='my:myFields'>
        <DynamicEntity Name='csp_businessregistration' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' 
        xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
        <Properties xmlns='http://schemas.microsoft.com/crm/2006/WebServices'>

			
					<xsl:if test='//my:CitizenAddress/text()'>
						<Property xsi:type='StringProperty' Name='csp_address'>
							<Value><xsl:value-of select='//my:CitizenAddress'/></Value>
						</Property>
					</xsl:if>

			
					<xsl:if test='//my:CitizenCity/text()'>
						<Property xsi:type='StringProperty' Name='csp_city'>
							<Value><xsl:value-of select='//my:CitizenCity'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenZip/text()'>
						<Property xsi:type='StringProperty' Name='csp_postalcode'>
							<Value><xsl:value-of select='//my:CitizenZip'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenEmail/text()'>
						<Property xsi:type='StringProperty' Name='csp_emailaddress'>
							<Value><xsl:value-of select='//my:CitizenEmail'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenPhone/text()'>
						<Property xsi:type='StringProperty' Name='csp_phone'>
							<Value><xsl:value-of select='//my:CitizenPhone'/></Value>
						</Property>
					</xsl:if>

					<xsl:if test='//my:CitizenFax/text()'>
						<Property xsi:type='StringProperty' Name='csp_fax'>
							<Value><xsl:value-of select='//my:CitizenFax'/></Value>
						</Property>
					</xsl:if>

				<xsl:if test='//my:BusinessDescription/text()'>
        <Property xsi:type='StringProperty' Name='csp_description'>
          <Value><xsl:value-of select='//my:BusinessDescription'/></Value>
        </Property>
        </xsl:if>


        <xsl:if test='//my:BusinessEmployeeBand/text()'>
        <Property xsi:type='StringProperty' Name='csp_employeeband'>
          <Value><xsl:value-of select='//my:BusinessEmployeeBand'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessEstablishedDate/text()'>
        <Property xsi:type='CrmDateTimeProperty' Name='csp_establisheddate'>
          <Value><xsl:value-of select='//my:BusinessEstablishedDate'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessMobilePhone/text()'>
        <Property xsi:type='StringProperty' Name='csp_mobilephone'>
          <Value><xsl:value-of select='//my:BusinessMobilePhone'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessName/text()'>
        <Property xsi:type='StringProperty' Name='csp_organizationname'>
          <Value><xsl:value-of select='//my:BusinessName'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessAddress/text()'>
        <Property xsi:type='StringProperty' Name='csp_businessaddress'>
          <Value><xsl:value-of select='//my:BusinessAddress'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessCity/text()'>
        <Property xsi:type='StringProperty' Name='csp_businesscity'>
          <Value><xsl:value-of select='//my:BusinessCity'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessEmailaddress/text()'>
        <Property xsi:type='StringProperty' Name='csp_businessemailaddress'>
          <Value><xsl:value-of select='//my:BusinessEmailaddress'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessFax/text()'>
        <Property xsi:type='StringProperty' Name='csp_businessfax'>
          <Value><xsl:value-of select='//my:BusinessFax'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessPhone/text()'>
        <Property xsi:type='StringProperty' Name='csp_businessphone'>
          <Value><xsl:value-of select='//my:BusinessPhone'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessPostalcode/text()'>
        <Property xsi:type='StringProperty' Name='csp_businesspostalcode'>
          <Value><xsl:value-of select='//my:BusinessPostalcode'/></Value>
        </Property>
        </xsl:if>					
					
        <xsl:if test='//my:BusinessPaymentAmount/text()'>
        <Property xsi:type='CrmMoneyProperty' Name='csp_paymentamount'>
          <Value><xsl:value-of select='//my:BusinessPaymentAmount'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessPaymentDate/text()'>
        <Property xsi:type='CrmDateTimeProperty' Name='csp_paymentdate'>
          <Value><xsl:value-of select='//my:BusinessPaymentDate'/></Value>
        </Property>
        </xsl:if>
					
				<xsl:if test='//my:BusinessPaymentMethod/text()'>
				<Property xsi:type='PicklistProperty' Name='csp_paymentmethod'>
				<xsl:choose>
				<xsl:when test="//my:BusinessPaymentMethod='Cheque'"><Value>1</Value></xsl:when>
				<xsl:when test="//my:BusinessPaymentMethod='Bank Transfer'"><Value>2</Value></xsl:when>
				<xsl:when test="//my:BusinessPaymentMethod='Visa'"><Value>3</Value></xsl:when>
				</xsl:choose>
				</Property>
				</xsl:if>

        <xsl:if test='//my:BusinessRegistrationNumber/text()'>
        <Property xsi:type='StringProperty' Name='csp_registrationnumber'>
          <Value><xsl:value-of select='//my:BusinessRegistrationNumber'/></Value>
        </Property>
        </xsl:if>

				<xsl:if test='//my:BusinessSICCode/text()'>
					<Property xsi:type='PicklistProperty' Name='csp_siccode'>
						<xsl:choose>
							<xsl:when test="//my:BusinessSICCode='Agriculture, Horticultural, Rural Services'"><Value>1</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Animal Services'"><Value>2</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Arts'"><Value>3</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Business Services'"><Value>4</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Cars, Machinery, Parts'"><Value>5</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Cleaning Services'"><Value>6</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Communication, Electricity, Utilities, Waste'"><Value>7</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Community Services'"><Value>8</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Construction, Building, Installation, Trade'"><Value>9</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Consultancy'"><Value>10</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Education'"><Value>11</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Engineering, Mining, Services'"><Value>12</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Financial, Accounting, Insurance'"><Value>13</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Government'"><Value>14</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Hair and Beauty'"><Value>15</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Health and Medical'"><Value>16</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='IT, Design, Photography'"><Value>17</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Legal Services'"><Value>18</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Management, HR'"><Value>19</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Manufacturing'"><Value>20</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Media, Advertising, Entertainment'"><Value>21</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Other Services'"><Value>22</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Parks and Gardens'"><Value>23</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Party Hire'"><Value>24</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Printing'"><Value>25</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Property, Real Estate'"><Value>26</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Retail, Consumer Products and Services'"><Value>27</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Sales, Marketing'"><Value>28</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Science and Mapping'"><Value>29</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Security'"><Value>30</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Sports, Recreation'"><Value>31</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Storage'"><Value>32</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Technical, Trades Services'"><Value>33</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Tourism, Accommodation, Food, Beverage'"><Value>34</Value></xsl:when>
							<xsl:when test="//my:BusinessSICCode='Transport, Logistics, Warehousing'"><Value>35</Value></xsl:when>
							<xsl:otherwise><Value>100</Value></xsl:otherwise>
						</xsl:choose>
					</Property>
				</xsl:if>

				<xsl:if test='//my:BusinessVatNumber/text()'>
        <Property xsi:type='StringProperty' Name='csp_vatnumber'>
          <Value><xsl:value-of select='//my:BusinessVatNumber'/></Value>
        </Property>
        </xsl:if>

        <xsl:if test='//my:BusinessWebsite/text()'>
        <Property xsi:type='StringProperty' Name='csp_website'>
          <Value><xsl:value-of select='//my:BusinessWebsite'/></Value>
        </Property>
        </xsl:if>
					
</Properties></DynamicEntity></xsl:template></xsl:stylesheet>
